package com.voice.client.message;

import com.voice.client.Client;
import com.voice.client.message.callback.MessageCallback;
import com.voice.client.message.entity.Message;

import java.io.IOException;
import java.util.concurrent.CompletableFuture;

public interface MessageClient extends Client {

    void connect(MessageCallback callback);

    void setMessageListener(MessageCallback callback);

    void setMessageListener(String topic, MessageCallback callback);

    CompletableFuture<Boolean> subscribe(String topic);

    CompletableFuture<Boolean> subscribe(String topic, MessageCallback callback);

    CompletableFuture<Boolean> unsubscribe(String topic);

    CompletableFuture<Message> publish(String topic, Message message);

    void ack(Message message);

    void publishServerPort(int port) throws IOException;
}
